function Tests = parseEqtnsTest( )
Tests = functiontests(localfunctions);
end
%#ok<*DEFNU>




function testParseEqtns(this)
blk = file2char('parseEqtnsTest.txt');
[userEqtn, eqtnLabel, ...
    dynamLhs, dynamRhs, dynamSign, ...
    steadyLhs, steadyRhs, steadySign, ...
    maxSh, minSh, lsInvalidTimeSubs, lsEmptyEqtn] ...
    = theparser.parseeqtns(blk);

expUserEqtn = { ...
    'x{-10}=y{+10};', ...
    'a{-1}=b{-5};', ...
    'c{2}=d{+3}!!c=0;', ...
    'e{t+2*10}=f{t-100-100}!!e=f;', ...
    'g{2*k}=0!!g=0;', ...
    'a+b+c+d+e+f+g;', ...
    'j{+4}=2*j{t-4};', ...
    };

expEqtnLabel = { ...
    'Label1', ...  
    '', ...
    '', ...
    '''Label4'';', ...
    'Invalid Time Subscript', ...
    'No Equal Sign', ...
    '''Multiple Labels 3''', ...
    };

expDynamLhs = { ...
    'x{@-10}', ...
    'a{@-1}', ...
    'c{@+2}', ...
    'e{@+20}', ...
    'g', ...
    '', ...
    'j{@+4}', ...
    };

expDynamRhs = { ...
    'y{@+10}', ...
    'b{@-5}', ...
    'd{@+3}', ...
    'f{@-200}', ...
    '0', ...
    'a+b+c+d+e+f+g', ...
    '2*j{@-4}', ...
    };

expDynamSign = { ...
    '=', ...
    '=', ...
    '=', ...
    '=', ...
    '=', ...
    '', ...
    '=', ...    
    };

expSteadyLhs = { ...
    '', ...
    '', ...
    'c', ...
    'e', ...
    'g', ...
    '', ...
    '', ...
    };

expSteadyRhs = { ...
    '', ...
    '', ...
    '0', ...
    'f', ...
    '0', ...
    '', ...
    '', ...
    };

expSteadySign = { ...
    '', ...
    '', ...
    '=', ...
    '=', ...
    '=', ...
    '', ...
    '', ...
    };

expMaxSh = 20;
expMinSh = -200;

expLsInvalidTimeSubs = { ...
  '{2*k}', ...
  };

expLsEmptyEqtn = { ...
    '"Label Only";', ...
    };

assertEqual(this,userEqtn,expUserEqtn);
assertEqual(this,eqtnLabel,expEqtnLabel);
assertEqual(this,dynamLhs,expDynamLhs);
assertEqual(this,dynamRhs,expDynamRhs);
assertEqual(this,dynamSign,expDynamSign);
assertEqual(this,steadyLhs,expSteadyLhs);
assertEqual(this,steadyRhs,expSteadyRhs);
assertEqual(this,steadySign,expSteadySign);
assertEqual(this,maxSh,expMaxSh);
assertEqual(this,minSh,expMinSh);
assertEqual(this,lsInvalidTimeSubs,expLsInvalidTimeSubs);
assertEqual(this,lsEmptyEqtn,expLsEmptyEqtn);
end